package com.sykj.cloud.activity.service.impl;

import com.sykj.cloud.activity.domain.ActivityOrder;
import com.sykj.cloud.activity.mapper.ActivityOrderMapper;
import com.sykj.cloud.activity.service.IActivityOrderService;
import com.sykj.cloud.common.core.utils.DateUtils;
import com.sykj.cloud.common.core.utils.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 活动订单记录Service业务层处理
 *
 * @author mr.will
 * @date 2021-04-01
 */
@Service
public class ActivityOrderServiceImpl implements IActivityOrderService
{
    @Autowired
    private ActivityOrderMapper activityOrderMapper;

    /**
     * 新增活动订单记录
     *
     * @param activityOrder 活动订单记录
     * @return 结果
     */
    @Override
    public int insertActivityOrder(ActivityOrder activityOrder)
    {
        activityOrder.setGuid(IdUtils.fastSimpleUUID());
        activityOrder.setCreateTime(DateUtils.getNowDate());
        return activityOrderMapper.insertActivityOrder(activityOrder);
    }

    /**
     * 修改活动订单记录
     *
     * @param activityOrder 活动订单记录
     * @return 结果
     */
    @Override
    public int updateActivityOrder(ActivityOrder activityOrder)
    {
        activityOrder.setUpdateTime(DateUtils.getNowDate());
        return activityOrderMapper.updateActivityOrder(activityOrder);
    }

    /**
     * 批量删除活动订单记录
     *
     * @param guids 需要删除的活动订单记录ID
     * @return 结果
     */
    @Override
    public int deleteActivityOrderByIds(String[] guids)
    {
        return activityOrderMapper.deleteActivityOrderByIds(guids);
    }

    /**
     * 删除活动订单记录信息
     *
     * @param guid 活动订单记录ID
     * @return 结果
     */
    @Override
    public int deleteActivityOrderById(String guid)
    {
        return activityOrderMapper.deleteActivityOrderById(guid);
    }

    /**
     * 查询活动订单记录
     *
     * @param guid 活动订单记录ID
     * @return 活动订单记录
     */
    @Override
    public ActivityOrder getActivityOrderById(String guid)
    {
        return activityOrderMapper.getActivityOrderById(guid);
    }

    /**
     * 查询活动订单记录列表
     *
     * @param activityOrder 活动订单记录
     * @return 活动订单记录
     */
    @Override
    public List<ActivityOrder> listActivityOrders(ActivityOrder activityOrder)
    {
        return activityOrderMapper.listActivityOrders(activityOrder);
    }
}
